package cn.school.client;

import java.io.*;
import java.net.Socket;


public class HttpClient {

	public static void main(String[] args) throws Exception, IOException {
		Socket s = new Socket("www.ahflcp.com.cn", 80);
		InputStream in = s.getInputStream();
		OutputStream out = s.getOutputStream();

		PrintWriter pw = new PrintWriter(out);
		pw.println("GET http://www.ahflcp.com.cn/customization/lottery/kjls_ssq.html?cp=1  HTTP/1.1");
		//pw.println("HOST: www.bdqn.cn");
		pw.println("Host: www.ahflcp.com.cn");
        pw.println("Connection: keep-alive");
		pw.println("Cache-Control: max-age=0");
				pw.println("Upgrade-Insecure-Requests: 1");
						pw.println("User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.45 Safari/537.36");
								pw.println("Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9");
										pw.println("Accept-Encoding: gzip, deflate");
												pw.println("Accept-Language: zh-CN,zh;q=0.9,zh-TW;q=0.8,en-US;q=0.7,en;q=0.6");
														pw.println("Cookie: _gscu_162213139=381028114wpk9w73; fcweb_session=\"gAJ9cQEu:1msbv2:HQVrLL2m0ZCF6x94IZXPuxDdQhk\"");

		pw.println();//空行
		pw.flush();

		BufferedReader br = new BufferedReader(new InputStreamReader(in));
		String str = null;
		while ((str = br.readLine()) != null) {
			System.out.println(str);
		}
		s.close();
	}
}
